<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlterTableOrdersAddColumnPay extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('orders',function (Blueprint $table){
            $table->unsignedTinyInteger('payChannel')->default(0)->comment("支付渠道 1支付宝 2微信 3现金")->after('payPrice');
            $table->unsignedTinyInteger('payAction')->default(0)->comment('支付操作类型 1用户主扫 2用户被扫 3 小程序支付')->after('payPrice');
            $table->unsignedTinyInteger('isDeleted')->default(0)->comment('是否删除 1：已删除 0 未删除')->after('remark');
            $table->index('completeTime','idx_completeTime');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table("orders",function (Blueprint $table) {
           $table->dropColumn('payChannel');
           $table->dropColumn('payAction');
           $table->dropColumn('isDeleted');
           $table->dropIndex('idx_completeTime');
        });
    }
}
